home *** CD-ROM | disk | FTP | other *** search
/ TPUG - Toronto PET Users Group / TPUG Users Group CD / TPUG Users Group CD.iso / C64 / T-TPUG Old Monthly Disks / (c)t6.d64 / u boat.c (.txt) < prev    next >
Commodore BASIC  |  2007-02-04  |  5KB  |  149 lines

  1. 1 REM WRITTEN BY MARK VITTEK
  2. 2 REM COMPUTE NOVEMBER 1983
  3. 3 REM UPGRADED BY MIKE FLAVEL
  4. 100 POKE55,0:POKE56,48:CLR:PRINT"[147]"CHR$(8):GOTO880
  5. 110 :
  6. 120 FORI=0TO27:POKEI+54272,0:NEXT
  7. 130 POKE54296,15:POKE54272,100:POKE54273,5:POKE54277,0:POKE54278,249
  8. 140 POKE54279,100:POKE54280,2:POKE54284,0:POKE54285,249
  9. 150 POKE54291,0:POKE54292,249:M=V:GOTO340
  10. 160 :
  11. 170 MV=1:P=PEEK(56320):IFP=127THENMV=0
  12. 180 IF(PAND16)=0ORLTHENGOSUB420
  13. 190 IF(PAND8)=0THENAY=AY+1:X=12:IFAY>38THENAY=AY-1
  14. 200 IF(PAND4)=0THENAY=AY-1:X=10:IFAY<0THENAY=AY+1
  15. 210 IF(PAND2)=0THENAX=AX+40:IFAX>360THENAX=AX-40
  16. 220 IF(PAND1)=0THENAX=AX-40:IFAX<-80THENAX=AX+40
  17. 230 A=AX+AY+1424:P=PEEK(A):P0=PEEK(A+1):IFMVTHENPOKEA1,17:POKEA1+1,17
  18. 240 POKEA,X:POKEA+1,X+1:A1=A
  19. 250 IFP<2ORP0<2THEN760
  20. 260 LM=LM+1:IFLM<RRTHEN300
  21. 270 N1=N1+40:CO=PEEK(N1):IFN1=AORN1=A+1THENPOKEN1-40,17:GOTO760
  22. 280 IFN1>AORCO<3THEN680
  23. 290 POKEN1-40,17:POKEN1,1
  24. 300 IFM>VTHENPRINT"[144]"MID$(A$(TT),H,40);:H=H+M2:IFH=H1THENM=0:H=1
  25. 310 M=M+1:IFM=VTHEN340
  26. 320 GOTO170
  27. 330 :
  28. 340 LM=0:N1=1344+AY:T=RND(1)*6+1:ONTGOTO390,380,370,360
  29. 350 TT=RND(1)*2+1:H=2:H1=44:M2=1:RR=40-(LM+AY):GOTO310
  30. 360 TT=RND(1)*2+3:H=44:H1=02:M2=-2:RR=-(LM-AY)/2:GOTO310
  31. 370 TT=RND(1)*2+3:H=46:H1=02:M2=-2:T=RND(1)*37:N1=1344+T:RR=3-(LM-T)/2:GOTO310
  32. 380 TT=4:H=46:H1=2:M2=-1:T=RND(1)*37:N1=1344+T:RR=3-(LM-T):GOTO310
  33. 390 TT=2:H=2:H1=44:M2=1:T=RND(1)*38:N1=1344+T:RR=40-(LM+T):GOTO310
  34. 400 :
  35. 410 REM TORP
  36. 420 L=L+1:IFL<2THENC=A:IFX=12THENC=A+1
  37. 430 C=C-40:CO=PEEK(C):IFCO<17THEN460
  38. 440 POKEC+40,17:IFC<1344THENL=0:RETURN
  39. 450 POKEC,14:RETURN
  40. 460 IFCO<>0ANDCO<>1THEN540
  41. 470 POKE54276,129:POKE54276,128
  42. 480 FORT=-1TO1:FORI=-1TO1:C1=PEEK(C+I+T*40)
  43. 490 IFC1=1THENRR=99:LM=0
  44. 500 IFC1>9ANDC1<14THENM1=1
  45. 510 L=0:POKEC+I+T*40,(RND(1)*2)+18:NEXT:NEXT:IFM1=1THEN760
  46. 520 FORT=-1TO1:FORI=-1TO1:POKEC+I+T*40,17:NEXT:NEXT:RETURN
  47. 530 :
  48. 540 PRINT"[156]"MID$(A$(0),H,40):POKEC+40,17:POKEC-40,32
  49. 550 POKE54276,129:POKE54276,128
  50. 560 FORT=1TO100:NEXT
  51. 570 PRINT"                                        ";
  52. 580 M=0:L=0:IFCO<7THENBS=BS+1
  53. 590 IFCO>6THENMS=MS+1
  54. 600 IFLM<RRTHENRR=99
  55. 610 IFMS+BS=5THENPOKE53281,7:V=20
  56. 620 IFMS+BS=15THENPOKE53281,14:V=10
  57. 630 IFMS+BS=30THENPOKE53281,10
  58. 631 IFMS+BS=45THENPOKE53281,12
  59. 633 IFMS+BS=70THENPOKE53281,3
  60. 634 IFMS+BS=100THENPOKE53281,13
  61. 635 IFMS+BS=120THENPOKE53281,4
  62. 636 IFMS+BS=150THENPOKE53281,2
  63. 640 IF(MS+BS)/5=INT((MS+BS)/5)THENFORT=1TO8:POKE1384+(RND(1)*359),0:NEXT:J=1
  64. 650 IFJ=1THENFORT=-1TO2:FORI=-1TO1:POKEA+T+I*40,17:NEXT:NEXT:J=0
  65. 660 RETURN
  66. 670 :
  67. 680 RR=99:ML=0:POKE54283,129:POKE54283,128
  68. 690 FORT=-1TO1:FORI=-1TO1:C1=PEEK(N1+I+T*40)
  69. 700 IFC1=14THENL=0
  70. 710 IFC1>9ANDC1<14THENM1=1
  71. 720 POKEN1+I+T*40,(RND(1)*2)+18:NEXT:NEXT:IFM1=1THEN760
  72. 730 FORT=-1TO1:FORI=-1TO1:POKEN1+I+T*40,17:NEXT:NEXT:GOTO300
  73. 740 :
  74. 750 REM SUB DEATH
  75. 760 POKEA,15:POKEA+1,16:POKE54286,0:POKE54290,129
  76. 770 FORT=230TO255STEP.15:POKE54287,255-T:POKE53281,15ANDT:NEXT:POKE54290,128
  77. 780 FORT=1TO50:POKEA,(RND(1)*2)+18:POKEA+1,(RND(1)*2)+18
  78. 790 NEXT:POKE53272,21:POKE53280,0:POKE53281,5
  79. 800 PRINT"[147][144]"SPC(9)"YOU SANK"BS"CARRIER";CHR$(-83*(BS<>1))
  80. 810 PRINT SPC(10)"AND"MS"DESTROYER";CHR$(-83*(MS<>1))
  81. 820 PRINTSPC(6)"PRESS TRIGER TO PLAY AGAIN":I=0
  82. 830 IF(PEEK(56320)AND16)=0THENRUN890
  83. 840 I=I+1:IFI>1000THENPRINT"[147]";:LOAD"M",8
  84. 850 GOTO830
  85. 860 :
  86. 870 REM INIT
  87. 880 GOSUB1060
  88. 890 PRINT"[147]":POKE53280,0:POKE53281,1
  89. 900 POKE53272,28:POKE54296,15:ZZ=80000
  90. 910 X=10:V=30:AX=360:AY=20:RR=30:H=2
  91. 920 PRINTSPC(13)"[144]  U-BOAT  64  "
  92. 930 A$(1)="                                       BDE   "
  93. 940 A$(2)="                                       FG   "
  94. 950 A$(3)="                                           BCDE "
  95. 960 A$(4)="                                           HI "
  96. 970 A$(0)="                                        OPOP "
  97. 980 FORT=1TO4:PRINT"[158]QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ";:NEXT
  98. 990 PRINT""
  99. 1000 FORT=1TO12:PRINT"QQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQQ";:NEXT
  100. 1010 FORT=1824TO2023:POKET,17:POKE54272+T,0:NEXT
  101. 1020 FORT=1TO15:POKE1384+RND(1)*359,0:NEXT
  102. 1030 POKE1794,17:POKE1795,17:GOTO120
  103. 1040 :
  104. 1050 :
  105. 1060 POKE53280,0:POKE53281,0:PRINT"[147][152]"SPC(13)"  U-BOAT 26  "
  106. 1070 PRINTSPC(10) "ONE MOMENT PLEASE"
  107. 1080 FORI=0TO58:READA:POKE49152+I,A:NEXT:SYS49152
  108. 1090 READT:IFT=-1THEN1130
  109. 1100 POKE12288+Q,T:Q=Q+1:GOTO1090
  110. 1110 :
  111. 1120 REM INSTRUCTIONS
  112. 1130 PRINT"[147]FIRE TORPEDOES FORM THE SUB'S FRONT"
  113. 1140 PRINT"   TO SINK SHIPS AND DESTROY MINES."
  114. 1150 PRINT"BEWARE OF THE DESTRUCTIVE AREA WHEN"
  115. 1160 PRINT"    MINES AND DEPTH CHARGES EXPLODE."
  116. 1170 PRINT"   DESTROY AS MANY SHIPS AS YOU CAN"
  117. 1180 PRINT"BEFORE YOUR ARE PERMANENTLY RETRIED."
  118. 1185 PRINT"USE JOYSTICK IN PORT 2"
  119. 1190 PRINTSPC(12)"PRESS TRIGGER":POKE198,0
  120. 1200 IFPEEK(56320)AND16THEN1200
  121. 1210 RETURN
  122. 1220 :
  123. 1230 DATA 173,14,220,41,254,141,14,220,165,1,41,251,133,1,169
  124. 1240 DATA 48,133,252,169,208,133,254,169,0,133,251,133,253
  125. 1250 DATA 162,8,177,253,145,251,200,208,249,230,254,230,252
  126. 1260 DATA 202,208,242,165,1,9,4,133,1,173,14,220,9,1,141,14,220,96
  127. 1270 :
  128. 1280 DATA 182,193,213,128,201,193,182,255
  129. 1290 DATA 255,159,159,159,243,243,243,255
  130. 1300 DATA 0,0,0,0,255,101,63,31
  131. 1310 DATA 0,96,112,252,255,148,255,255
  132. 1320 DATA 0,14,30,127,255,145,255,255
  133. 1330 DATA 0,0,0,0,255,166,252,248
  134. 1340 DATA 0,0,4,4,15,10,127,63
  135. 1350 DATA 0,192,196,200,208,224,255,254
  136. 1360 DATA 0,3,35,19,11,7,255,127
  137. 1370 DATA 0,0,32,32,240,80,254,252
  138. 1380 DATA 254,254,252,252,0,133,208,224
  139. 1390 DATA 255,255,127,63,0,80,3,31
  140. 1400 DATA 255,255,254,254,0,10,192,248
  141. 1410 DATA 127,127,63,63,0,161,11,7
  142. 1420 DATA 255,239,239,239,239,199,215,255
  143. 1430 DATA 65,41,68,175,122,189,110,219
  144. 1440 DATA 17,74,148,125,218,180,221,182
  145. 1450 DATA 255,255,255,255,255,255,255,255
  146. 1460 DATA191,213,187,92,171,237,190,219
  147. 1470 DATA 247,174,181,125,235,189,173,222
  148. 1480 DATA-1
  149.